package com.sac.approval.enums;

/**
 *审批状态枚举类
 * @author xiaodong
 * @date 2018年10月16日 上午8:51:49
 * @desc
 */
public enum ApprovalStatusEnum {

	/**
	 * 定时发送
	 */
	DELAYED_SENDING("DELAYED_SENDING",-1),
	/**
	 * 保留
	 */
	RESERVED("RESERVED",0),
	/**
	 * 未审批/进行中
	 */
	PENDING("Pending",1),
	/**
	 * 审批同意
	 */
	APPROVED("Approved",2),
	/**
	 * 驳回
	 */
	REJECT("Reject",3),
	/**
	 * 取消
	 */
	CANCELED("Canceled",4),
	/**
	 * 特批
	 */
	ARBITRARY("Arbitrary",5),
	/**
	 * 补批
	 */
	POST_APPROVAL("Post approval",6);

	private String name;
	private int value;

	private ApprovalStatusEnum(String name,int value) {
		this.name = name;
		this.value = value;
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return this.name+"_"+this.value;
	}

	public static ApprovalStatusEnum getStatusEnumByValue(int value){
		for (ApprovalStatusEnum status :
				ApprovalStatusEnum.values()) {
			if (value==status.getValue()){
				return status;
			}
		}
		return null;
	}
}
